package com.huidu.bitrade.dao;

import java.util.List;

import com.huidu.bitrade.constant.CertifiedBusinessStatus;
import com.huidu.bitrade.dao.base.BaseDao;
import com.huidu.bitrade.entity.BusinessAuthApply;
import com.huidu.bitrade.entity.Member;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @author QQ：97095646
 * @date 2019/5/7
 */
public interface BusinessAuthApplyDao extends BaseDao<BusinessAuthApply> {

    List<BusinessAuthApply> findByMemberOrderByIdDesc(Member member);

    List<BusinessAuthApply> findByMemberAndCertifiedBusinessStatusOrderByIdDesc(Member member, CertifiedBusinessStatus certifiedBusinessStatus);

    long countAllByCertifiedBusinessStatus(CertifiedBusinessStatus status);

    @Query(value = "select a.* from business_auth_apply a where  a.member_id = :memberId and a.certified_business_status=1 and a.business_auth_deposit_strategy_id is not null",nativeQuery = true)
    List<BusinessAuthApply> findApplying(@Param("memberId") Long memberId);

}
